//
//  HWMeTool.m
//  JWC
//
//  Created by lanou on 16/4/7.
//  Copyright © 2016年 陈帅. All rights reserved.
//

#import "HWMeTool.h"
#import "HttpTool.h"
#import "HWMeModel.h"
#import "MJExtension.h"
#import "RequestManage.h"

@implementation HWMeTool

// 回去广场button   block回调  将NSArray传过去
- (void)getToolData:(void(^)(id json))block
{

    NSDictionary *dic = @{@"a":@"square",@"c":@"topic"};
    [HttpTool post:@"http://api.budejie.com/api/api_open.php?" parameters:dic success:^(id json) {
        NSArray *meArray = [HWMeModel mj_objectArrayWithKeyValuesArray:json[@"square_list"]];
        block(meArray);
    } failure:^(NSError *error) {
        NSLog(@"网络请求错误");
    }];

// http://api.budejie.com/api/api_open.php?
//    a=square&appname=bs0315&asid=343E3FCD-7956-457E-A34B-1EB21EBFB362&c=topic&client=iphone&device=ios%20device&from=ios&jbk=0&mac=&market=&openudid=d3bfbee05674b031cc4723816c0d79b8178a8f7a&udid=&ver=4.1
    
//    [RequestManage requestWithUrl:@"http://api.budejie.com/api/api_open.php?a=square&c=topic" requestType:RequestTypePOST parDic:nil finish:^(NSData *data) {
//        
//        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
//        NSArray *listArray = dic[@"square_list"];
//        NSMutableArray *meArray = [NSMutableArray array];
//        for (NSDictionary *listDic in listArray)
//        {
//            HWMeModel *model = [[HWMeModel alloc]init];
//            [model setValuesForKeysWithDictionary:listDic];
//            [meArray addObject:model];
//        }
//        block(meArray);
//    } error:^(NSError *error) {
//        NSLog(@"网络请求错误");
//    }];
}

@end
